-
Notifications
You must be signed in to change notification settings - Fork 1k
feat(duckdb)!: transpile bigquery's %x format literal #6375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2480db8 to
6a781d7
Compare
…e-dependent formats.
…e-dependent formats.
1d7f43e to
4514a5c
Compare
tests/dialects/test_bigquery.py
Outdated
| write={ | ||
| "bigquery": "SELECT FORMAT_DATETIME('%x', '2023-12-25 15:30:00')", | ||
| "duckdb": "SELECT STRFTIME(CAST('2023-12-25 15:30:00' AS TIMESTAMP), '%x')", | ||
| "duckdb": "SELECT STRFTIME(CAST('2008-12-25' AS DATE), '%m/%d/%y')", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did this change to a date? how did that happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did this change to a date? how did that happen?
not done with testing yet. Testing with various inputs . I have some tests that are failing. Working on it.
Will update the file asap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
post the changes made in bigquery.py the following test is failing .
self.validate_all( "SELECT FORMAT_DATETIME('%x', '2023-12-25 15:30:00')", write={ "bigquery": "SELECT FORMAT_DATETIME('%x', '2023-12-25 15:30:00')", "duckdb": "SELECT STRFTIME(CAST('2023-12-25 15:30:00' AS TIMESTAMP), '%m/%d/%y')", }, )
when the matching in trie happens -> %D is resolved as the canonical token.
My understanding is write-> bigquery should be updated to "bigquery": "SELECT FORMAT_DATETIME('%D', '2023-12-25 15:30:00')",
let me know if its okay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
%x and %X should be canonical, let's switch the order, that should fix the test
| this=expr_type(this=seq_get(args, 1)), | ||
| format=seq_get(args, 0), | ||
| zone=seq_get(args, 2), | ||
| # "bigquery")(expr_type(... -> "bigquery")([expr_type(...]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this comment
done
| **Dialect.DATE_PART_MAPPING, | ||
| "DAYOFWEEKISO": "ISODOW", | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this new line
* feat(snowflake)!: %x is treated a literal in duckdb. support %x locale-dependent formats. * feat(snowflake)!: %x is treated a literal in duckdb. support %x locale-dependent formats. * Revert "feat(snowflake)!: %x is treated a literal in duckdb. support %x locale-dependent formats." This reverts commit 4514a5c. * Revert "feat(snowflake)!: %x is treated a literal in duckdb. support %x locale-dependent formats." This reverts commit a2400e8. * feat(snowflake)!: transpilation support for %x formatting - format_date -bq to duckdb * feat(snowflake)!: transpilation support for %x formatting - format_date -bq to duckdb * feat(snowflake)!: transpilation support for %x formatting - format_date -bq to duckdb * feat(snowflake)!: transpilation support for %x formatting - format_date -bq to duckdb * feat(snowflake)!: transpilation support for %x formatting - format_date -bq to duckdb * feat(snowflake)!: transpilation support for %x formatting - format_date -bq to duckdb
DuckDB
Ignores %x because locale-dependent formats are not supported.
Providing support to match the bigquery format mm/dd/yy